package com.IM.commandType;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum ChatCommandType {
    CHAT_PRIVATE(1),

    CHAT_GROUP(2),
    CHAT_ERROR(-1);

    private Integer code;

    public static ChatCommandType match(Integer code){
        for (ChatCommandType type: ChatCommandType.values()) {
            if(type.getCode().equals(code)){
                return type;
            }
        }
        return CHAT_ERROR;
    }
}
